#include "record.h"
#include <QDebug>
record::record()
{
    qDebug()<<"record的构造函数";
    this->c_r = NULL;
    this->inP = time(0);
    this->outP = time(0);
    this->moneyP = 0;
    this->isAd = false;
}
void record::inadd(car &c_T)
{
    qDebug()<<"记录入库的车辆信息和时间信息";
    this->c_r = &c_T;
    this->inP = time(0);
}
void record::outadd()
{
    qDebug()<<"记录出库的车辆信息和时间信息，并计算停车费用";
    this->outP = time(0);
    qDebug()<<"入场时间"<<this->inP<<"出场时间"<<this->outP;
    if(this->outP - this->inP > 10)//因为是模拟，所以用秒数代替实际的分钟数
    {
        this->moneyP = 10;
    }
    if(this->outP - this->inP > 20)
    {
        this->moneyP = 15;
    }
    if(this->outP - this->inP > 30)
    {
        this->moneyP = 15 + (this->outP - this->inP - 30)*1.5;
    }
    qDebug()<<"需交钱数"<<this->moneyP;
}

void record::setisAd()
{
    this->isAd = !this->isAd;
}
